<html>
	<head>
		<style>
			canvas {border: 1px solid red }
		</style>
		<script>
			function init(){
				var buffCanvas = document.createElement("canvas")
				buffCanvas.setAttribute('width',200)
				buffCanvas.setAttribute('height',200)
				var bctx = buffCanvas.getContext('2d')
				bctx.fillRect(20,20,100,100);

				var testCanvas = document.getElementById('testing')
				var ctx = testCanvas.getContext('2d')
				ctx.drawImage(buffCanvas,0,0)
			}

		</script>

	</head>
	<body onload = "init()">

		<canvas id="testing" height="200" width="200" >canvas</canvas>

	</body>

</html>